<?php
/**
 * 批量发送邮件
 * 读文件中的邮件,存在数组里了,用163的邮件发送
 * 
 * 发送用的是163的服务器,会有限制，所以每个邮件可以发20次，每封发40个地址
 */
exit("处理好");
set_time_limit(0);
ini_set('date.timezone', "Asia/Shanghai");
$s8 = microtime(true);

$host_email_address = array(
	array("Host"=>"127.0.0.1","userNmae"=>"56uhgj3433nfgh@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周二粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"cvbrh3434rrth@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周三粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"dfghdf3343ghvbn@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周四粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"dgr333434hh@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周五粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"erger2g@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周六粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"erger22ger@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周日粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"erge2rgerg@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周一粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"erhe2rh@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周二粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"fg232hd@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周三粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"fgn2ny2n5@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周四粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"f234534n@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周五粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"k2yutt2t@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周六粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"rfh2fg2nc@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周日粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"rge2rge2rg@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周一粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"rhuy23u2kyuk@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周二粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"shsaq232n@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周三粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"vb2323nc@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周四粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"vbnc223v@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周五粉"),
	array("Host"=>"127.0.0.1","userNmae"=>"xowlwlcls22f@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周六粉"),
);
$host_email_address_count = count($host_email_address);

$body = <<<eot
<HTML><BODY>
<h1><a style="text-decoration:none;" href="http://www.itylw.com/m/l.php" target="_blank">图片欣赏</a></h1>
<hr style="height:0;border-style:dashed;border-width:1px 0 0;margin:12px 0 18px;">
	
<p style="color:#555555;font-family:'Helvetica Neue', HelveticaNeue, Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;line-height:32px;text-indent:32px;white-space:normal;background-color:#FFFFFF;">
她们接戏也很受限制，无论到哪里都被贴着“事业线”的标签。所以为了星途坦荡，。这大概让 “一马平川”的妹子们听着伤心了，但不得不承认，她反而是这些大胸演员里面发展最好的一位。不偏题了，我们的主要目的还是要饱个眼福先。同时，也要向她们表示敬意，不管是hold不住的御姐型，还是美胸胜过了演技，不得不承认，养眼也是她们。。。。。<a href="http://www.itylw.com/m/l.php" target="_blank">查看更多图片</a>
</p>
<p><a href="http://www.itylw.com/m/l.php" target="_blank" title="闫妮穿衣不慎疑似凸点内裤勒痕清晰可见[12]"><img src="http://www.itylw.com/img/rm/10630.jpg"/></a>
<p><a href="http://www.itylw.com/m/l.php" target="_blank" title="我最喜欢的成熟之美，气质非凡[32]"><img src="http://www.itylw.com/img/rm/10685.jpg"/></a></p>
<p><a href="http://www.itylw.com/m/l.php" target="_blank" title="窈窕性感妩媚  [10]"><img src="http://www.itylw.com/img/rm/10663.jpg"/></a></p>
<p><a href="http://www.itylw.com/m/l.php" target="_blank" title="性感的吊带美媚...[13]"><img src="http://www.itylw.com/img/rm/10605.jpg"/></a></p>
<p><a href="http://www.itylw.com/m/l.php" target="_blank" title="这样的夜店，这样的美女[40]"><img src="http://www.itylw.com/img/rm/10370.jpg"/></a></p>
<div style="border-top: 2px solid #00A6FC; padding: 10px 0;">
<p>
	<a href="http://www.itylw.com/news/view/id/10105.php" target="_blank"><img src="http://www.itylw.com/upload/s/10-breast-a.jpg"></a>
	<a href="http://www.itylw.com/news/view/id/10105.php" target="_blank"><img src="http://www.itylw.com/upload/s/10-breast-b.jpg"></a> 
</p>

<p style="color:#000;">请不要回复此邮件!您可以回复到<strong>itylw_admin@163.com</strong></p>
<img src="http://www.itylw.com/t/c.php?i=2"/>
</div>
</BODY></HTML>
eot;

$send_max = 50;//每封邮件发送给多少个人
include_once "send_email_function.php";
$success = 0;$faile = 0;
$sum_send = 0;//共发送多少封
$count= 0 ;//多少封发一次计数
$Addressee = array();//发送地址

$fp = fopen("status_".date("Ymd_H_i_s").".txt", "a");//将当前的状态写入文件

//每次只能循环5个,到每个文件中取地址
for ($i = 21; $i <= 21; $i++) {
	$email_all_array = include_once "data/data_".$i.".php";

	
	foreach($email_all_array as $value){
		if($count == $send_max){
			$title = "你好_这是我的_".rand(1,9999)."_也是你的";
			
			$keyEmail = ($sum_send%$host_email_address_count);
			$flage = send_email_function($host_email_address[$keyEmail],$Addressee,$title,$body);//发送邮件
			$end8 = date("Y-m-d H:i:s");
			if($flage){
				$success++;
				
				fwrite($fp, "成功:{$success},失败:{$faile},时间:{$end8}");//写入日志
			}else{
				$faile++;
				fwrite($fp, "成功:{$success},失败:{$faile},时间:{$end8},{$value}");//写入日志
				sleep(60);
			}
			if($sum_send%18 == 0)
				sleep(2);
			$sum_send++;//多少封发一次计数
			
			//发送地址重新计算
			$count = 0;
			$Addressee = array();
		}
		$count++;
		$Addressee[] = $value;
	}
}
//将最后余的发送
if(!empty($Addressee))
	(send_email_function($host_email_address[0],$Addressee,"很好_到最后了",$body))?$success++:$faile++;
	
echo "success:".$success."faile:".$faile;
echo "<br>time:".number_format(microtime(true) - $s8, 3, '.', '')."s";




